<?php
/**
 * @package		Joomla.Site
 * @subpackage	com_mailto
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// no direct access
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
?>
<script type="text/javascript">
    Joomla.submitbutton = function(pressbutton) {
        var form = document.getElementById('mailtoForm');

        // do field validation
        if (form.mailto.value == "" || form.from.value == "") {
            alert('<?php echo JText::_('COM_MAILTO_EMAIL_ERR_NOINFO'); ?>');
            return false;
        }
        form.submit();
    }
</script>
<?php
$data = $this->get('data');
?>
<form class="well" action="<?php echo JURI::base() ?>index.php" id="mailtoForm" method="post">
    <a class="close" data-dismiss="alert" href="javascript: void window.close()">×</a>
    <fieldset>
        <legend style="margin:0;padding:0;"><?php echo JText::_('COM_MAILTO_EMAIL_TO_A_FRIEND'); ?></legend>
        <label><?php echo JText::_('COM_MAILTO_EMAIL_TO'); ?></label>
        <input type="text" class="span3" id="mailto_field" name="mailto" value="<?php echo $this->escape($data->mailto); ?>"/>
        <label><?php echo JText::_('COM_MAILTO_SENDER'); ?></label>
        <input type="text" class="span3" id="sender_field" name="sender" value="<?php echo $this->escape($data->sender); ?>"/>
        <label><?php echo JText::_('COM_MAILTO_YOUR_EMAIL'); ?></label>
        <input type="text" class="span3" id="from_field" name="from" value="<?php echo $this->escape($data->from); ?>"/>
        <label><?php echo JText::_('COM_MAILTO_SUBJECT'); ?></label>
        <input type="text" class="span3" id="subject_field" name="subject" value="<?php echo $this->escape($data->subject); ?>"/>
        <br />
        <button class="btn btn-primary" onclick="return Joomla.submitbutton('send');">
            <?php echo JText::_('COM_MAILTO_SEND'); ?>
        </button>
        <button class="btn btn-warning" onclick="window.close();return false;">
            <?php echo JText::_('COM_MAILTO_CANCEL'); ?>
        </button>
        <input type="hidden" name="layout" value="<?php echo $this->getLayout(); ?>" />
        <input type="hidden" name="option" value="com_mailto" />
        <input type="hidden" name="task" value="send" />
        <input type="hidden" name="tmpl" value="component" />
        <input type="hidden" name="link" value="<?php echo $data->link; ?>" />
        <?php echo JHtml::_('form.token'); ?>
    </fieldset>
</form>
